package cn.ms.doctor.Mapper;

import cn.ms.doctor.Entity.Order;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @Entity cn.ms.doctor.Entity.Order
 */
public interface OrderMapper {

    /**
     * 根据医生ID，患者ID，诊断ID获取订单ID
     * @param userId
     * @param patientId
     * @param prescriptionId
     * @return
     */
    Integer getOrderIdByUserIdAndPatientIdAndPrescriptionId(@Param("userId") Integer userId,@Param("patientId")  Integer patientId,@Param("prescriptionId")  Integer prescriptionId);

    /**
     * 获取订单信息
     * @param params
     * @return
     */
    @MapKey("orderId")
    List<Map<String,Object>> getOrderBySearch(Map<String, Object> params);

    /**
     * 添加订单
     * @param order
     * @return
     */
    boolean addOrder(Order order);

    /**
     * 修改订单状态
     * @return
     */
    boolean updateStateByOrderId(Order order);


    /**
     * 获取所有超过十二小时没有支付的订单
     * @return
     */
    List<Integer> getOrderIdByNoPay();
}




